package com.bit.book.enums;

import lombok.Getter;

public enum BookStatus {
    DELETE(0, "无效"),
    NORMAL(1, "可借阅"),
    FORBIDDEN(2, "不可借阅");

    @Getter
    private int code;
    @Getter
    private String desc;

    BookStatus(int code, String desc) {
        this.code = code;
        this.desc = desc;
    }
    public static BookStatus getStatusByCode(Integer code){
        switch (code){
            case 0: return BookStatus.DELETE;
            case 1: return BookStatus.NORMAL;
            case 2: return BookStatus.FORBIDDEN;
            default:
                return null;
        }
    }

}
